﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using webapp4U.BOL;

public partial class Controls_ControlSupport : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Pager.IndexChanged += new EventHandler(PageIndex_Changed);
        if (!Page.IsPostBack)
            this.DataBind();
    }
    private void PageIndex_Changed(Object sender, EventArgs e)
    {
        DataBind();
    }
    public override void DataBind()
    {
        // hien thi bao nhieu hinh tren 1 trang
        Pager.PageSize = 12;
        string LanguageCode = "vi-vn";
        if (Session["lang"] != null)
            LanguageCode = Session["lang"].ToString();

        List<FAQ> obj = FAQ.GetAllFAQ(Pager.PageIndex, Pager.PageSize, LanguageCode);
        rptSupport.DataSource = obj;
        rptSupport.DataBind();

        Pager.TotalRecords = FAQ.GetCountFAQ(LanguageCode);

        // kiem tra xem co can hien thi phan trang ko
        if (Pager.TotalRecords <= 1)
            DisplayPager.Visible = false;
        else
            DisplayPager.Visible = true;
    }
}
